﻿<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">系统设置</a></li>
    </ul>
</div>

<div class="main">
    <form method="post" id="_form" class="form form-lg ui-validForm" data-source="@ViewBag.SystemConfig" data-validate-params="beforeSubmit:'BeforeSubmit',tipsStyle:1">
        <div class="tabcontent" data-tab-params="tabName:'系统参数设置'">

            <div class="form-group">
                <label class="control-label">AccessKeyId</label>
                <div class="controls form-inline">
                    <input type="text" name="System_AccessKeyId" id="System_AccessKeyId" class="form-control form-control-sm" maxlength="18">
                    <span class="help-block">AccessKeyId/AccessKeySecret具有最高权限的通讯令牌，请勿对外泄漏</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">AccessKeySecret</label>
                <div class="controls form-inline">
                    <input type="text" name="System_AccessKeySecret" id="System_AccessKeySecret" class="form-control form-control-sm" maxlength="32">
                    <span class="help-block">设置后请勿对外泄露</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">网站主域名绑定</label>
                <div class="controls">
                    <input type="text" name="Domain" class="form-control form-control-sm" id="Domain" maxlength="50" value="@ViewBag.Domain" data-validate="dataType:'*',nullMsg:'请填写网站主域名'">
                    <span class="help-block">如：http://www.domain.net,如采用非80端口，需加上端口号，多域名建议进行绑定</span>
                </div>
            </div>

            <div class="form-group">
                    <label class="control-label">管理后台绑定域名</label>
                    <div class="controls">
                        <input type="text" name="System_AdminDomain" class="form-control form-control-sm" id="System_AdminDomain" maxlength="50">
                        <span class="help-block">如：http://admin.pageadmin.net，留空则默认主域名+后台地址访问</span>
                    </div>
                </div>

            <div class="form-group">
                <label class="control-label">会员中心绑定域名</label>
                <div class="controls">
                    <input type="text" name="System_MemberDomain" class="form-control form-control-sm" id="System_MemberDomain" maxlength="50">
                    <span class="help-block">如：http://u.pageadmin.net，留空则默认主域名+/member访问</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">域名约束方式</label>
                <div class="controls form-inline">
                    <select id="DomainConstraint" name="DomainConstraint" class="form-control">
                        <option value="equal">1、绑定域名和打开域名完全匹配（推荐）</option>
                        <option value="equal-exclude-port">2、只匹配域名部分，端口不检测（适用进行端口映射的网站）</option>
                        <option value="contain">3、绑定域名包含打开域名即可匹配</option>
                        <option value="contain-exclude-port">4、绑定域名包含打开域名即可匹配，端口部分不检测</option>
                        <option value="reverse-contain">5、打开域名包含绑定域名即可匹配</option>
                        <option value="reverse-contain-exclude-port">6、打开域名包含绑定域名即可匹配，端口部分不检测</option>
                    </select>
                    <span class="help-block">设置绑定域名和打开域名的匹配方式</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">网站错误拦截</label>
                <div class="controls radio">
                    <label class="radio-inline">
                        <input type="radio" name="System_ExceptionHandled" id="System_ExceptionHandled" value="true">开启
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="System_ExceptionHandled" id="System_ExceptionHandled" value="false" checked>关闭
                    </label>
                    <span class="help-block">注：在网站调试过程中建议关闭，方便错误的追踪，开启后，页面不显示错误描述，只写到错误日志中</span>
                </div>
            </div>


            <div class="form-group">
                <label class="control-label">数据表缓存时间</label>
                <div class="controls form-inline">
                    <input type="text" name="System_TableCacheMinutes" id="System_TableCacheMinutes" class="form-control form-control-xs" maxlength="10" value="60" onkeyup="if(isNaN(value) || value.Trim()==''){this.value='60'}">分钟
                    <span class="help-block">0为不进行缓存，正常上线后可根据实际设置</span>
                </div>
            </div>


            <div class="form-group">
                <label class="control-label">自动任务执行间隔</label>
                <div class="controls form-inline">
                    <input type="text" name="System_AutoTaskInterval" id="System_AutoTaskInterval" class="form-control form-control-xs" maxlength="10" value="600" onkeyup="if(isNaN(value) || value.Trim()==''){this.value='600'}">秒
                    <span class="help-block">单位为秒，信息的自动上线，自动过期，计划任务等时间间隔，设为0表示所有自动任务不会执行</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">日志自动清理</label>
                <div class="controls form-inline">
                    <input type="text" name="System_LogExpire" id="System_LogExpire" class="form-control form-control-xs" maxlength="5" value="10" onkeyup="if(isNaN(value) || value.Trim()==''){this.value='10'}">天前的日志
                    <span class="help-block">0为不自动清理</span>
                </div>
            </div>
        </div>

        <div class="tabcontent" id="systemConfig" data-tab-params="tabName:'安全设置'">
            <div class="form-group">
                <label class="control-label">安装界面</label>
                <div class="controls radio">
                    <label class="radio-inline">
                        <input type="radio" name="InstallEnabled" id="InstallEnabled" value="false" checked>禁止安装
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="InstallEnabled" id="InstallEnabled" value="true" @(ViewBag.InstallEnabled == "true" ? "checked" : "")>允许安装
                    </label>
                    <span class="help-block">如果不需要运行<a href="/Initialization/Install" target="_blank"><span class="label label-default">安装界面</span></a>，请设为禁止安装，否则会导致安全隐患</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">加密秘钥</label>
                <div class="controls form-inline">
                    <div class="input-group">
                        <input type="text" name="System_SecretKey" id="System_SecretKey" readonly class="form-control form-control-sm" maxlength="50">
                        <span class="input-group-btn">
                            <button type="button" class="btn btn-default btn-sm" onclick="document.getElementById('System_SecretKey').value = newGuid()">随机生成</button>
                        </span>
                    </div>
                    <span class="help-block">第一次使用务必修改，主要用于系统的对称加密秘钥</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">后台目录</label>
                <div class="controls">
                    <input type="text" name="System_AdminPath" id="System_AdminPath" class="form-control form-control-sm" maxlength="20" data-validate="dataType:'*',nullMsg:'请填写后台目录!',errorMsg:'后台目录只能由数字好字符串组成!'">
                    <span class="help-block"></span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">后台登陆认证码</label>
                <div class="controls">
                    <input type="text" name="System_AdminAuthenticationCode" id="System_AdminAuthenticationCode" class="form-control form-control-sm" maxlength="10">
                    <span class="help-block">留空则表示不填写</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">后台允许的IP段</label>
                <div class="controls">
                    <textarea id="System_AdminIPLimit" name="System_AdminIPLimit" class="form-control textarea" onkeyup="this.value=this.value.replace(/[\r\n]/g,'')"></textarea>
                    <span class="help-block">ip之间用分隔符“|”线隔开,结尾支持通配符，例如"192.168.*"可匹配192.168.0.0～192.168.255.255范围内的Ip</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">时间戳有效期</label>
                <div class="controls form-inline">
                    <input type="text" name="System_TimestampInterval" id="System_TimestampInterval" class="form-control form-control-xs" maxlength="5" value="10" onkeyup="if(isNaN(value) || value.Trim()=='' || value.Trim()=='0'){this.value='1'}">分钟
                    <span class="help-block">系统默认的Api请求都需要带有时间戳，超过有效期后请求将失效</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">登录过期时间</label>
                <div class="controls form-inline">
                    <input type="text" name="System_LoginedExpireMinutes" id="System_LoginedExpireMinutes" class="form-control form-control-xs" maxlength="5" value="30" onkeyup="if(isNaN(value) || value.Trim()=='' || value.Trim()=='0'){this.value='30'}">分钟
                    <span class="help-block">用户登录后，如果不做任何操作，将会在规定时间内过期并退出</span>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label">登录出错保护</label>
                <div class="controls">
                    <select name="System_LoginProtect" id="System_LoginProtect" class="form-control form-control-sm ui-show-hide">
                        <option value="" hideObjs=".LoginLockTimes,.LoginLockType,.LoginLockMinutes,.LoginLockMinutes">关闭</option>
                        <option value="admin" showObjs=".LoginLockTimes,.LoginLockType,.LoginLockMinutes,.LoginLockMinutes">后台登录</option>
                        <option value="member" showObjs=".LoginLockTimes,.LoginLockType,.LoginLockMinutes,.LoginLockMinutes">会员登录</option>
                        <option value="all" showObjs=".LoginLockTimes,.LoginLockType,.LoginLockMinutes,.LoginLockMinutes">后台登录和会员登录</option>
                    </select>
                    <span class="help-block"></span>
                </div>
            </div>

            <div class="form-group LoginLockTimes">
                <label class="control-label">登陆出错数上限</label>
                <div class="controls">
                    <input type="text" name="System_LoginLockErrorTimes" id="System_LoginLockErrorTimes" class="form-control form-control-xs" maxlength="10" value="3" onkeyup="if(isNaN(value) || value.Trim()=='' || value.Trim()=='0'){this.value='3'}">
                    <span class="help-block">出错超过上限后将被锁定</span>
                </div>
            </div>

            <div class="form-group LoginLockType">
                <label class="control-label">登录锁定方式</label>
                <div class="controls radio">
                    <label class="radio-inline">
                        <input type="radio" name="System_LoginLockType" id="System_LoginLockType" value="lockip" checked>锁定IP
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="System_LoginLockType" id="System_LoginLockType" value="lockuser">锁定用户名
                    </label>
                    <span class="help-block"></span>
                </div>
            </div>

            <div class="form-group LoginLockMinutes">
                <label class="control-label">登陆锁定时间</label>
                <div class="controls form-inline">
                    <input type="text" name="System_LoginLockMinutes" id="System_LoginLockMinutes" class="form-control form-control-xs" maxlength="10" value="30" onkeyup="if(isNaN(value) || value.Trim()=='' || value.Trim()=='0'){this.value='30'}">分钟
                    <span class="help-block">被锁定后的自动解锁时间</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">同一用户同时登陆</label>
                <div class="controls">
                    <select name="System_MultipleLogin" id="System_MultipleLogin" class="form-control form-control-sm">
                        <option value="false">不允许（推荐）</option>
                        <option value="true">允许</option>
                    </select>
                    <span class="help-block">选择不允许，如果多个用户同时登陆，后登陆的用户会把前面登陆的用户退出</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">登录cookie Ip校验</label>
                <div class="controls">
                    <select name="System_CheckLoginIP" id="System_CheckLoginIP" class="form-control form-control-sm ui-show-hide">
                        <option value="true">是</option>
                        <option value="false">否</option>
                    </select>
                    <span class="help-block">如果进行ip校验，电脑ip更换后登陆将失效，但是安全性会大大提高</span>
                </div>
            </div>

            <div id="FileConfig" data-source="@ViewBag.FileConfig">
                <div class="form-group">
                    <label class="control-label">允许编辑文件格式</label>
                    <div class="controls">
                        <input type="text" name="File_CanReadExt" id="File_CanReadExt" class="form-control" maxlength="150" value="txt,xml,config,cs,cshtml">
                        <span class="help-block">设置后可以在文件管理中进行内容编辑，建议只设置文本类型文件格式</span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">禁止上传文件格式</label>
                    <div class="controls">
                        <input type="text" name="File_ForbiddenFileExt" id="File_ForbiddenFileExt" class="form-control" maxlength="150" value=".asp,.aspx,.asa,.asax,.php,.ashx">
                        <span class="help-block">被禁止上传的后缀文件，在上传文件时会被屏蔽</span>
                    </div>
                </div>
            </div>

        </div>

        <!--更新或读取Thumbnail_config-->
        <div class="tabcontent" data-tab-params="tabName:'文件上传设置'">
            <div id="waterMarkConfig" data-source="@ViewBag.WaterMarkConfig">
                <!--更新或读取WaterMark.config-->
                <div class="form-group">
                    <label class="control-label">水印功能</label>
                    <div class="controls radio">
                        <label class="radio-inline">
                            <input type="radio" name="WaterMark_Open" id="WaterMark_Open" value="0" checked>关闭
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="WaterMark_Open" id="WaterMark_Open" value="1" checked>开启
                        </label>
                        <span class="help-block"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">水印图片路径</label>
                    <div class="controls  form-inline">
                        <input type="hidden" maxlength="50" name="WaterMark_Image" id="WaterMark_Image" class="form-control ui-preview ui-uploadPanel" data-upload-params="fileType:'image',fileSingleSizeLimit:'500',fileNumLimit:'1',extensions:'jpg,jpeg,gif,png',mimeTypes:'image/jpg,image/jpeg,image/png,image/gif',savePath:'/Upload/SysConfig/',saveFileName:'waterMark',rename:false,deleteRepeat:true,saveToAttachmentData:false,sortByDate:false" />
                        <span class="help-block">建议用透明png文件作为水印图片</span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">水印位置</label>
                    <div class="controls">
                        <select name="WaterMark_Position" id="WaterMark_Position" class="form-control form-control-xs">
                            <option value="1">左上角</option>
                            <option value="2">顶部中间</option>
                            <option value="3">右上角</option>
                            <option value="4">左侧</option>
                            <option value="5">正中</option>
                            <option value="6">右侧</option>
                            <option value="7">左下角</option>
                            <option value="8">底部中间</option>
                            <option value="9">右下角</option>
                        </select>
                        <span class="help-block"></span>
                    </div>
                </div>


                @*<div class="form-group">
                        <label class="control-label">水印图质量</label>
                        <div class="controls">
                            <select name="WaterMark_Quality" id="WaterMark_Quality" class="form-control form-control-xs">
                                <option value="10">1</option>
                                <option value="20">2</option>
                                <option value="30">3</option>
                                <option value="40">4</option>
                                <option value="50">5</option>
                                <option value="60">6</option>
                                <option value="70">7</option>
                                <option value="80">8</option>
                                <option value="90">9</option>
                                <option value="100">10</option>
                            </select>
                            <span class="help-block"></span>
                        </div>
                    </div>*@

                <div class="form-group">
                    <label class="control-label">水印透明度</label>
                    <div class="controls">
                        <select name="WaterMark_Alpha" id="WaterMark_Alpha" class="form-control form-control-xs">
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                        </select>
                        <span class="help-block"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">增加水印条件</label>
                    <div class="controls form-inline">
                        <span>图片宽大于<input type="text" name="WaterMark_MinWidth" id="WaterMark_MinWidth" class="form-control" style="width:100px;margin:0px 5px;" maxlength=4 value="400" onkeyup="if(isNaN(value) || value.Trim()=='' || value.Trim()=='0'){this.value='300'}">px</span>
                        <span>图片高大于<input type="text" name="WaterMark_MinHeight" id="WaterMark_MinHeigh" class="form-control" style="width:100px;margin:0px 5px;" maxlength=4 value="400" onkeyup="if(isNaN(value) || value.Trim()=='' || value.Trim()=='0'){this.value='300'}">px</span>
                        <span class="help-block"></span>
                    </div>
                </div>


                <div class="form-group">
                    <label class="control-label">编辑器图片加水印</label>
                    <div class="controls radio">
                        <label class="radio-inline">
                            <input type="radio" name="WaterMark_UsedInEditor" id="WaterMark_UsedInEditor" value="1" checked>是
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="WaterMark_UsedInEditor" id="WaterMark_UsedInEditor" value="0" checked>否
                        </label>
                        <span class="help-block">如果需要编辑器上传图片自动添加水印，请选择是</span>
                    </div>
                </div>
            </div>

            <!--更新或读取Editor.config的image节点-->
            <div id="editorConfig" data-source="@ViewBag.EditorConfig">
                <div class="form-group">
                    <label class="control-label">编辑器图片格式</label>
                    <div class="controls">
                        <input type="text" maxlength="50" class="form-control form-control-sm" name="Editor_ImageExt" id="Editor_ImageExt" value=".gif,.jpg,.jpeg,.png" />
                        <span class="help-block">允许上传的图片格式</span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">编辑器图片最大限制</label>
                    <div class="controls">
                        <input type="text" maxlength="9" class="form-control form-control-sm" style="width:100px;" name="Editor_ImageMaxSize" id="Editor_ImageMaxSize" value="1000" onkeyup="if(isNaN(value) || value.Trim()=='' || value.Trim()=='0'){this.value='1024'}" />
                        <span class="help-block">单位:KB，图片上传最大限制</span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">编辑器视频格式</label>
                    <div class="controls">
                        <input type="text" maxlength="50" class="form-control form-control-sm" name="Editor_MediaExt" id="Editor_MediaExt" value=".mp4" />
                        <span class="help-block">允许上传的视频格式</span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">编辑器视频最大限制</label>
                    <div class="controls">
                        <input type="text" maxlength="9" class="form-control form-control-sm" style="width:100px;" name="Editor_MediaMaxSize" id="Editor_MediaMaxSize" value="1000" onkeyup="if(isNaN(value) || value.Trim()=='' || value.Trim()=='0'){this.value='1024'}" />
                        <span class="help-block">单位:KB，视频文件上传最大限制</span>
                    </div>
                </div>

                <!--更新或读取Editor.config的file节点-->
                <div class="form-group">
                    <label class="control-label">编辑器附件格式</label>
                    <div class="controls">
                        <input type="text" class="form-control form-control-sm" maxlength="50" name="Editor_FileExt" id="Editor_FileExt" value=".doc,.docx,.xls" />
                        <span class="help-block">允许上传的附件格式</span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label">编辑器附件最大限制</label>
                    <div class="controls">
                        <input type="text" class="form-control form-control-sm" maxlength="9" name="Editor_FileMaxSize" style="width:100px;" id="Editor_FileMaxSize" value="1000" onkeyup="if(isNaN(value) || value.Trim()=='' || value.Trim()=='0'){this.value='1024'}" />
                        <span class="help-block">单位:KB，文件上传最大限制</span>
                    </div>
                </div>
            </div>
        </div>

        <div class="tabcontent" id="emailConfig" data-tab-params="tabName:'邮件发送设置'" data-source="@ViewBag.EmailConfig">
            <div class="form-group">
                <label class="control-label">发件邮箱</label>
                <div class="controls">
                    <input type="text" name="Email_UserName" id="Email_UserName" class="form-control form-control-sm" maxlength=45 />
                    <span class="help-block">如：demo@demo.net</span>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label">邮箱密码</label>
                <div class="controls">
                    <input type="password" name="Email_PassWord" id="Email_PassWord" class="form-control form-control-sm" maxlength=45 />
                    <span class="help-block"></span>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label">发件方名称</label>
                <div class="controls">
                    <input type="text" name="Email_DisplayName" id="Email_DisplayName" class="form-control form-control-sm" maxlength=45 value="pageadmin网站管理系统" />
                    <span class="help-block">如:PageAdmin</span>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label">邮箱服务器</label>
                <div class="controls">
                    <input type="text" name="Email_Host" id="Email_Host" class="form-control form-control-sm" maxlength=45 />
                    <span class="help-block">如：smtp.pageadmin.net</span>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label">邮箱发送端口</label>
                <div class="controls">
                    <input type="text" name="Email_Port" id="Email_Port" class="form-control form-control-sm" style="width:100px;" maxlength="10" onkeyup="if(isNaN(this.value) || value.Trim()=='' || value.Trim()=='0'){this.value='25'}" value="25" />
                    <span class="help-block">默认：25</span>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label">是否启用SSl</label>
                <div class="controls radio">
                    <label class="radio-inline">
                        <input type="radio" name="Email_EnableSsl" id="Email_EnableSsl" value="false" checked>否
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="Email_EnableSsl" id="Email_EnableSsl" value="true">是
                    </label>
                    <span class="help-block"></span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">邮件签名</label>
                <div class="controls">
                    <textarea id="Email_Sign" name="Email_Sign" class="form-control textarea" style="height:60px">邮件签名</textarea>
                    <span class="help-block"></span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">验证码邮件模板</label>
                <div class="controls">
                    <div class="form-group">
                        邮件标题<input type="text" name="SendCodeTemplate_EmailTitle" id="SendCodeTemplate_EmailTitle" class="form-control" maxlength=45 />
                    </div>

                    <div class="form-group">
                        邮件内容<textarea id="SendCodeTemplate_EmailContent" name="SendCodeTemplate_EmailContent" class="form-control textarea" style="height:100px"></textarea>
                    </div>

                    <span class="help-block">默认所有的邮件验证码邮件都共用此模板，内容中${code}表示验证码</span>
                </div>

            </div>
            <div class="form-group">
                <label class="control-label"></label>
                <div class="controls form-inline">
                    <button type="button" class="btn btn-default btn-sm" onclick="SendTest('email')">发送测试邮件</button>
                    <span class="help-block"></span>
                </div>
            </div>
        </div>

        <!--更新或读取Sms.config-->
        <div class="tabcontent" id="smsConfig" data-tab-params="tabName:'短信发送设置'" data-source="@ViewBag.SmsConfig">
            <div class="form-group">
                <label class="control-label">短信AccessKeyId</label>
                <div class="controls">
                    <input type="text" name="Sms_AccessKeyId" id="Sms_AccessKeyId" class="form-control form-control-sm" maxlength=50 />
                    <span class="help-block">短信服务提供，请勿泄露，PageAdmin的短信接口默认采用阿里云的接口，请自行申请</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">短信AccessKeySecret</label>
                <div class="controls">
                    <input type="text" name="Sms_AccessKeySecret" id="Sms_AccessKeySecret" class="form-control form-control-sm" maxlength=50 />
                    <span class="help-block">短信服务提供，请勿泄露</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label">短信签名</label>
                <div class="controls">
                    <input type="text" name="Sms_SignName" id="Sms_SignName" class="form-control form-control-sm" maxlength=20 placeholder="" />
                    <span class="help-block">必须是经过短信接口运营商审核通过的签名</span>
                </div>
            </div>


            <div class="form-group">
                <label class="control-label">验证码模板编号</label>
                <div class="controls">
                    <input type="text" name="SendCodeTemplate_SmsTemplateCode" id="SendCodeTemplate_SmsTemplateCode" class="form-control form-control-sm" maxlength=50 />
                    <span class="help-block">默认所有的验证码功能都使用此模板编号，模板中的${code}表示验证码</span>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label"></label>
                <div class="controls form-inline">
                    <button type="button" class="btn btn-sm btn-default" onclick="SendTest('sms')">发送测试验证码</button>
                    <span class="help-block"></span>
                </div>
            </div>
        </div>


        <div class="submit-footerbar">
            <label class="control-label"></label>
            <div class="controls">
                <input type="hidden" id="Guid" name="Guid" value="@Html.Guid()" />
                <input type="hidden" id="SendCodeTemplateConfig" value="@ViewBag.SendCodeTemplateConfig" />
                <button type="button" class="btn  btn-primary ui-pagePost" data-custom-params="url:'@Url.ActionUrl()',validForm:true">提交保存</button>
                <span class="help-block"></span>
            </div>
        </div>
    </form>
</div>


<script type="text/javascript">
    //初始化tab插件
    $(".tabcontent").InitTab();

    $("#_form").FormBind({ bindId: false, fieldPrefix: "System_", dataSourceFrom: "attr" });

    $("#DomainConstraint").val("@ViewBag.DomainConstraint");
    $("#System_Domain").val("@ViewBag.Domain");

    $("#FileConfig").FormBind({ bindId: false, fieldPrefix: "File_", dataSourceFrom: "attr" });
    $("#waterMarkConfig").FormBind({ bindId: false, fieldPrefix: "WaterMark_", dataSourceFrom: "attr" });

    $("#editorConfig").FormBind({ bindId: false, fieldPrefix: "Editor_", dataSourceFrom: "attr" });
    $("#emailConfig").FormBind({ bindId: false, fieldPrefix: "Email_", dataSourceFrom: "attr" });
    $("#smsConfig").FormBind({ bindId: false, fieldPrefix: "Sms_", dataSourceFrom: "attr" });
    var sendCodeTemplateConfig = $("#SendCodeTemplateConfig").val();
    $("#emailConfig").FormBind({ bindId: false, fieldPrefix: "SendCodeTemplate_" }, sendCodeTemplateConfig);
    $("#smsConfig").FormBind({ bindId: false, fieldPrefix: "SendCodeTemplate_" }, sendCodeTemplateConfig);

    //提交前执行
        function BeforeSubmit() {
            var memberDomain = $("#System_MemberDomain").val();
            var domain = $("#Domain").val();
            if (memberDomain.Trim() == domain.Trim())
            {
                Msg("会员域名不能和主域名一样!");
                $("#System_MemberDomain").focus();
                return false;
            }
        return true;
    }

    function SendTest(type) {
        var title;
        if (type == "email") {
            title = "邮件发送测试";
            var email = $('Mail.UserName').val();
            var params = { title: title, url: "@Url.ActionUrl("EmailTest")", width: "650px", height: "350px" };
            IDialog(params);
        }
        else {
            title = "短信发送测试";
            var params = { title: title, url: "@Url.ActionUrl("SmsTest")", width: "650px", height: "350px" };
            IDialog(params);
        }
    }

    function newGuid() {
        var guid = "";
        for (var i = 1; i <= 8; i++) {
            var n = Math.floor(Math.random() * 16.0).toString(16);
            guid += n;
        }
        return guid;
    }
</script>